package org.jumiz.telnet.session;

import java.nio.channels.SocketChannel;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

/**
 *
 */
public class SocketSession extends ConcurrentHashMap<String, Object> {

    public SocketSession() {
//        new Thread(() -> {
//            try {
//                Thread.sleep(10000);
//                List<String> collect = this.entrySet().stream().filter(item -> !item.getValue().isConnected()).map(item -> item.getKey()).collect(Collectors.toList());
//                if (collect != null && collect.size() > 0) {
//                    for (String key : collect) {
//                        System.out.println(String.format("session %s 清理", key));
//                        this.remove(key);
//                    }
//                }
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }).start();
    }

}
